package com.atguigu.gmall.realtime.util;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolUtil {

    //Executors.newFixedThreadPool 一律不适用，阿里开发手册明确禁止使用Executors 创建线程池

    static ThreadPoolExecutor threadPoolExecutor= new ThreadPoolExecutor(
            20, 20, 60 * 5,
            TimeUnit.SECONDS, new LinkedBlockingDeque<Runnable>(Integer.MAX_VALUE));


    public static  ThreadPoolExecutor getPool() {
        return  threadPoolExecutor;

    }
}


